/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package model.beans;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;

/**
 *
 * @author kelyane
 */

@Entity
@Table(name="Consulta")
@NamedQueries({
    @NamedQuery(name="findAllConsulta", query="from Consulta"),
    @NamedQuery(name="findConsultaHorario", query="SELECT c FROM Consulta c WHERE c.horario = :horario")
})
public class Consulta implements Serializable {
    
    @Id
    @GeneratedValue(strategy= GenerationType.AUTO)
    private Integer ID;
    
    @ManyToOne(cascade = CascadeType.REMOVE, fetch = FetchType.EAGER)
    @JoinColumn(name="CONSULTA_PACIENTE_ID",nullable=false )
    private Paciente paciente;
    
    @Column(name="MEDICO", length=150, nullable=false)
    private String medico;
    
    @Column(name="HORARIO", length=150, nullable=false)
    @Temporal(javax.persistence.TemporalType.DATE)
    private Date horario;  
    
    @Column(name="HORA", length=150, nullable=false)
    private String hora;
        
    private TipoConsulta tpConsulta;  

    public Consulta() {
        super();
    }
       
    public Consulta(Paciente paciente, String medico, Date horario, String hora, TipoConsulta tpConsulta){
        this.paciente = paciente;
        this.medico = medico;        
        this.horario = horario;
        this.hora = hora;
        this.tpConsulta = tpConsulta;                
    }
    
    public Paciente getPaciente() {
        return paciente;
    }

    public void setPaciente(Paciente paciente) {
        this.paciente = paciente;
    }

    public TipoConsulta getTpConsulta() {
        return tpConsulta;
    }

    public void setTpConsulta(TipoConsulta tpConsulta) {
        this.tpConsulta = tpConsulta;
    }

    public String getMedico() {
        return medico;
    }

    public void setMedico(String medico) {
        this.medico = medico;
    }

    public Date getHorario() {
        return horario;
    }

    public void setHorario(Date horario) {
        this.horario = horario;
    }

    public Integer getID() {
        return ID;
    }

    public void setID(Integer ID) {
        this.ID = ID;
    }

    public String getHora() {
        return hora;
    }

    public void setHora(String hora) {
        this.hora = hora;
    }

   
    
    
}
